 <template>
	<view class="content">
		<view class="cardHeader">
			<slot name="header"></slot>
			<template v-if="cardShowOptButton">
				<view class="carOptButton" @click="optButtonClieck()">
					<text>{{cardOptButtonTitle}}</text>
				</view>
			</template>
			
		</view>

		<view class="cardBody">
			<slot name="body"></slot>
		</view>

	</view>
</template>

<script>
	export default {
		name: "demo-card",
		props: {
			showOptButton: {
				type:Boolean,
			},
			optButtonTitle: {
				type:String,
			}
		},
		data() {
			return {
				cardShowOptButton: this.showOptButton,
				cardOptButtonTitle: this.optButtonTitle,
			};
		},
		methods:{
			optButtonClieck(){
				this.$emit('optButtonClieck');
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		// box-shadow: 0px 0px 10px #888888;
		margin: 10rpx;
		display: flex;
		flex-direction: column;
		border-style: solid;
		border-width: 1rpx;
		border-radius: 10rpx;
		border-color: #999999;

		.cardHeader {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			border-bottom-style: solid;
			border-bottom-width: 1rpx;
			border-bottom-color: #999999;
			padding: 10rpx;
			.carOptButton{
				background-color: #FA3534;
				padding: 10rpx;
				color: #FFFFFF;
				border-radius: 10rpx;
			}
		}

		.cardBody {
			display: flex;
			flex-direction: column;
			padding: 10rpx;
		}
	}
</style>
